package org.zhxy.model.exception;

import lombok.Getter;
import org.zhxy.model.result.ResultCode;

@Getter
public class BizException extends RuntimeException {
    private final ResultCode resultCode;

    // 用于已归档的错误信息
    public BizException(ResultCode resultCode) {
        super(resultCode.getMessage());
        this.resultCode = resultCode;
    }

    // 用于未归档的错误信息，包含自定义错误信息
    public BizException(String message) {
        super(message);
        this.resultCode = ResultCode.ERROR;
    }

    // 用于未归档的错误信息，不包含自定义错误信息
    public BizException() {
        super(ResultCode.ERROR.getMessage());
        this.resultCode = ResultCode.ERROR;
    }
}
